package com.wyix;

import java.net.*;
import java.util.Arrays;

/**
 * @author wangdx
 * @since 2025/8/5
 */
public class ConnectTest {
    public static void main(String[] args) throws MalformedURLException, UnknownHostException {
        // 1. 创建URL对象
        URL url = new URL("https://jsonplaceholder.typicode.com/users");
        String host = url.getHost();
        int port = url.getPort();
        System.out.println(port + ":" + port);
        System.out.println(host);

        InetAddress[] address = InetAddress.getAllByName(host);
        Arrays.stream(address).forEach(System.out::println);
    }
}
